package com.kefu.exam.vo;

import javax.validation.constraints.Size;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.exam.model.ExamSubjectType;
import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xy
 * @date 2022/02/28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "考题分类表")
public class ExamSubjectTypeInsertVo extends AbstractInsertVo<ExamSubjectType> {

    @Size(max = 200)
    @ApiModelProperty(value = "分类名")
    private String typeName;
    @Size(max = 200)
    @ApiModelProperty(value = "创建人姓名")
    private String createName;
    @Size(max = 200)
    @ApiModelProperty(value = "更新人姓名")
    private String updateName;
    @ApiModelProperty(value = "分类排序")
    private Integer typeSort;
    @Size(max = 500)
    @ApiModelProperty(value = "分类描述")
    private String typeComments;

    @Override
    public ExamSubjectType convert() {
        ExamSubjectType info = new ExamSubjectType();
	    info.setTypeName(typeName);
	    info.setCreateName(createName);
	    info.setUpdateName(updateName);
	    info.setTypeSort(typeSort);
	    info.setTypeComments(typeComments);
        KefuContext context = KefuContext.getKefuContext();
		//info.setTypeId(IdUtil.simpleUUID());
	    info.setTenantId(context.getTenantId());
	    info.setCreateTime(context.getNow());
	    info.setCreateUser(context.getUserId());
	    info.setUpdateUser(context.getUserId());
	    info.setUpdateTime(context.getNow());
	    return info;
	}
}